package cn.xopencode.recordservice.manager.kvtransformer;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.kvtransformer.KvTransformerRecordConvert;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.rpc.kvtransformer.dto.KvTransformerRecordCreateDTO;
import cn.xopencode.recordservice.rpc.kvtransformer.dto.KvTransformerRecordPageDTO;
import cn.xopencode.recordservice.rpc.kvtransformer.dto.KvTransformerRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.kvtransformer.vo.KvTransformerRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.kvtransformer.vo.KvTransformerRecordPageVO;
import cn.xopencode.recordservice.rpc.kvtransformer.vo.KvTransformerRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.service.kvtransformer.KvTransformerRecordService;
import cn.xopencode.recordservice.service.kvtransformer.bo.KvTransformerRecordCreateBO;
import cn.xopencode.recordservice.service.kvtransformer.bo.KvTransformerRecordUpdateBO;
import cn.xopencode.recordservice.service.robotroom.bo.AdminRecordPageBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 10KV变压器
 */
@Service
public class KvTransformerRecordManager {
    @Autowired
    private KvTransformerRecordService kvTransformerRecordService;

    public PageResult<KvTransformerRecordPageVO> pageKvTransformerRecord(KvTransformerRecordPageDTO pageDTO){
        return kvTransformerRecordService.pageKvTransformerRecord(KvTransformerRecordConvert.INSTANCE.convert(pageDTO));

    }

    public Integer createKvTransformerRecord(KvTransformerRecordCreateDTO createDTO){
        KvTransformerRecordCreateBO bo = KvTransformerRecordConvert.INSTANCE.convert(createDTO);
        Integer result = kvTransformerRecordService.createKvTransformerRecord(bo, createDTO.getEmpIds());
        return result;
    }

    public Integer updateKvTransformerRecord(KvTransformerRecordUpdateDTO updateDTO){
        KvTransformerRecordUpdateBO bo = KvTransformerRecordConvert.INSTANCE.convert(updateDTO);
        return kvTransformerRecordService.updateKvTransformerRecord(bo,updateDTO.getEmpIds());
    }

    public KvTransformerRecordUpdateVO getKvTransformerRecordById(String id){
        return kvTransformerRecordService.getKvTransformerRecordById(id);
    }

    public Integer dealKvTransformerRecordException(String recordId){
        return kvTransformerRecordService.dealKvTransformerRecordException(recordId);
    }

    public PageResult<KvTransformerRecordAdminPageVO> getAdminPageKvTransformerRecord(AdminRecordPageDTO pageDTO) {
        AdminRecordPageBO pageBO = AdminRecordConvert.INSTANCE.convert(pageDTO);
        return kvTransformerRecordService.getAdminPageKvTransformerRecord(pageBO);
    }
}
